package me.luger.project.fof.service;

import me.luger.core.dao.nutz.service.BaseService;
import me.luger.project.fof.entity.ProductType;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class ProductTypeService extends BaseService<ProductType> {
    public ProductTypeService(Dao dao) {
        super(dao);
    }

    public List<ProductType> getAllType(){
        Sql sql = Sqls.create("select id,name from fof_product_type");
        List<ProductType> typeList = this.list(sql);
        return typeList;
    }

    public List<ProductType> getTypeByProfitId(Integer profitId){
        Sql sql = Sqls.create("select id,name,rcm from fof_product_type where profitId = @profitId");
        sql.params().set("profitId", profitId);
        List<ProductType> productTypeList = this.list(sql);
        return productTypeList;
    }
}
